import http from '@/utils/http'

// 加入购物车
export const insertCartAPI = ({ skuId, count }) => {
    return http({
        method: 'POST',
        url: '/member/cart',
        data: {
            skuId,
            count
        }
    })
}

// 获取购物车列表
export const findNewCartListAPI = () => {
    return http({ method: 'GET', url: '/member/cart' })
}

//删除购物车
export const deleteCartAPI = (ids) => {
    return http({
        method: 'DELETE',
        url: '/member/cart',
        data: {
            ids,
        }
    })
}

// 合并购物车
export const mergeCartAPI = (data) => {
    return http({
        method: 'POST',
        url: '/member/cart/merge',
        data
    })
}

//修改购物车商品
export const updateCartAPI = ({skuId,selected,count}) =>{
    return http({
        method:'PUT',
        url:`/member/cart/${skuId}`,
        body:{
            selected,
            count
        }
    })
}